Skip to content
This repository has been archived by the owner on Nov 10, 2021. It is now read-only.

Dynamically determine DNS via getprop net.dns #85

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

shuhaowu
Copy link

Statically specifying cloudflare's server maybe problematic if you have internal DNS with internal hostnames. This PR uses android's getprop feature to create the DNS resolv.conf entry dynamically.

The caveat is that if the DNS server changes while during a session (disconnect, reconnect elsewhere), there might be an issue. Could add a fallback DNS to 1.1.1.1 in those cases?

Statically specifying cloudflare's server maybe problematic if you have internal DNS with internal hostnames. This PR uses android's getprop feature to create the DNS resolv.conf entry dynamically.

The caveat is that if the DNS server changes while during a session (disconnect, reconnect elsewhere), there might be an issue. Could add a fallback DNS to 1.1.1.1 in those cases?
@Neo-Oli
Copy link
Owner

Neo-Oli commented May 23, 2019

getprop net.dns1 requires root on newer versions of Android.

@ravener
Copy link

ravener commented Jul 24, 2019

@Neo-Oli it works on Android 9 without root

@SharifPoetra
Copy link

But how about android below 9? didn't you take care about it?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants